<?php echo $this->doctype('XHTML1_STRICT'); ?>
<?php
    $this->title = "Lista eventi";
    $this->headTitle($this->title);

    $allDisco = $this->allDisco;
    $zonaList = $this->zonaList;
?>
<?php
/**
 *  dispay all disco in  sponsor0
 */
$line = '<div id="box">';
foreach ($allDisco as $key=>$allDisco2){
    $line_new = '<h2><a href="'. $this->url(array('controller'=>'Club',
                                                  'name'=> $allDisco2[0],
                                                   ), 'locale', TRUE) .'">' . $allDisco2[1]
              . '</a></h2>';
    $line = $line . $line_new;
    }
$line = $line . '</div>';
$this->layout()->sponsor0 = $line;

/**
 * dispay all "provincia" in  provincia
 */
$line4 = '';
foreach ($zonaList as $key=>$zonaList2){
    $line4_new = '<h2><a href="'. $this->url(array('controller'=>'Index',
                                                    'action'=>'provincia',
                                                    'id'=> $zonaList2,
                                                   ), 'index', TRUE) .'">' . $zonaList2 . '</a></h2>';
    $line4 = $line4 . $line4_new;
    }
$line4 = $line4 . '';
$this->layout()->provincia = $line4;
?>
<?php
    $form = new Zend_Form();

    $discoList=$this->event;
    //print_r($discoList);
    $temp = $discoList[0];

    $piva = $this->piva;

   echo "<form action=\"/Admin/handle-disco-event/piva/" . $piva . "\"" . "method=\"post\">";
   echo "<table><tbody>";
   foreach($discoList as $discoList2 ) {
        /**
         *  Il parametro passato al controlle Ë costruito nel seguente modo:
         * 0_id_1
         * 0_id_0
         * 1_id_1
         * 1_id_0
         * il primo valore riguarda se l'evento Ë da modificare (1_) o meno (0_),
         * l'ultimo elemento informa se da attivare (1_) o no (0_).
         */
        echo "<tr>";
        echo "<td>";
        echo "Evento " . $discoList2['titolo'] . " ";
        echo "<td>";
        if($discoList2['status']==0) {// if is inactive
            echo "<button class=\"but_a\" type=\"submit\" name=\"id\" value=\"0_".$discoList2['id']."_1\">Attiva</button>";
        }
        else
        {
            echo "<button class=\"but_b\" type=\"submit\" name=\"id\"value=\"0_".$discoList2['id']."_0\">Disattiva</button>";
        }
        echo "</td>";
        echo "<td>";
        echo "<button class=\"but_c\" type=\"submit\" name=\"id\" value=\"1_".$discoList2['id']."_no\">Modifica l'evento</button>";
        echo "</td>";
        echo "<td>";
        echo "<button class=\"but_c\" type=\"submit\" name=\"id\" value=\"2_".$discoList2['id']."_no\">Modifica l'immagine</button>";
        echo "</td>";
        echo "</tr>";
    }
    echo "</tbody></table>";
    echo "</form>";

?>
<h5>
    <a href="<?php echo $this->url(array(
                                'controller'=>'admin',
                                'action'=>'index'),
                                'admin', TRUE);
                ?>"><- indietro
    </a>
</h5>